Setting Up Google Indexing API for Your Blogger Website

         This comprehensive guide will present an easy-to-follow roadmap to help you set up Google Indexing API on your Blogger website and ensure your posts are indexed swiftly, thereby improving your blog's search engine optimization (SEO).

What is Google Indexing API?

            It is a powerful tool put forth by Google aimed to streamline and expedite the indexing process of websites in the search engine. In our digitally dominated world, having your website appear in SERPs is critical for visibility, traffic, and ultimately success.

            Fundamentally, it is a channel of communication between your website and Google’s search mechanism, serving to update Google about any recent changes to your site like new pages, updated information, or deleted content.

Benefits of using Google API for Blogger websites

            In today's competitive online environment, utilizing the right tools can make all the difference for your blogging success. Among the arsenal of efficient tools available to bloggers, the API stands out as an indispensable resource.

Fast Indexing of New Content

            When you publish a new blog post, you naturally want it to be found as quickly as possible on search engines. While Google's crawlers work diligently to index new content, the process can often take several days. With API, you can significantly shorten this waiting period. By submitting your URLs directly to the API, your pages are crawled and indexed promptly, making your latest content more accessible to users at the earliest possible opportunity.

Immediate Removal of Deleted Content

            Occasionally, it might be necessary to delete certain blog posts or pages, whether they've become obsolete or irrelevant. However, the traditional crawling process can take time to recognize these deletions. By employing this, you can accelerate the removal of such content from Google's search results. This prevents users from encountering error pages (e.g., 404 errors) and contributes to better user experience.

Improved SEO Performance

            One of the most crucial aspects of a successful blog is strong SEO performance. It can assist bloggers in climbing search engine rankings by facilitating faster indexing, timely content updates, and efficient deletion of defunct content. Ultimately, this contributes to a more vibrant online presence and enhanced opportunities to reach your target audience.

Step-by-Step Guide to Setting Up Google Indexing API

            In this step-by-step guide, you’ll learn how to easily implement this powerful tool to make sure your website gets indexed by Google efficiently. So, let's get started!

            Note: You can see the Video Tutorial on How to use Google Indexing API for Blogger with Codes here.

Step 1: Create a Google Cloud Console Project

            Visit the Cloud Console and create a new project. Name your project understandably - perhaps after your blog name - then click on "Create."

Create a Google Cloud Console ProjectNote: Ensure that you create a Cloud console project using an email ID associated with your Blogger website and Search Console.

Step 2: Create Service Account
            The next step is to create a Service Account. From the dashboard, select "IAM & Admin" then "Service Accounts". 
Create Service Account

            Click "Create Service Account", name it, and assign the role "Owner".

Create Service Account 2


Step 3: Add Your Service Account as an Owner in Google Search Console

            Visit Search Console and add the email from your Service Account to your website property as an owner.

Add Your Service Account as an Owner in Google Search Console

            Now you have Successfully connected your Cloud Console with Search Console.

Step 4: Generate JSON Key

            After creating your Service Account, you need to generate a key. Under "Actions", click on the three dots and select "Manage keys". 

Generate JSON Key 1

            Select "Add Key" then "JSON".

Generate JSON Key 2

Generate JSON Key 3




Generate JSON Key 4

            A JSON key file will download - store this securely.

Generate JSON Key 5

Step 5: Enable the Indexing API

                Once your project is created, you'll need to enable the Indexing API. In the dashboard, click on "Enable APIs and Services" and search for 'Indexing API'. 

Enable the Indexing API 1

Enable the Indexing API 2

Enable the Indexing API 3

            Select it and click "Enable".

Enable the Indexing API 4

Step 6: Connecting to your Google Drive

            Go to this site Google Colab and then click on “open colab” and a new window opens and their select "New Notebook".

Connecting to your Google Drive 1

Connecting to your Google Drive 2


            After the notebook opens, click on "+Code". Paste the code provided below in the input field.

#@title **Connecting to Your Google Drive**

#@markdown **To use this method, you have to connect your Google Drive everytime you Refresh/Disconnect/Reset this notebook in order to use the files saved in your drive but no need to re-upload the file again**

 

#@markdown **Provide Yes > Execute the cell**

Connect_Google_Drive = "Yes" #@param ["Yes", "No"]

if Connect_Google_Drive == "Yes":

  from google.colab import drive

  drive.mount('/content/drive')

  print("Successfully Connected!")

else:

  print("Not Connected!")

Connecting to your Google Drive 3

Connecting to your Google Drive 4

            Click on "Run cell". When asked, select your email ID, then click "Allow" to grant permission. Once done, you will be re-directed back to the Colab Console tab, where you'll see a confirmation message stating, “Mounted at /content/drive successfully."

Connecting to your Google Drive 5


Step 7: Replacing your Google Drive path

        Click on "+Code". Paste the code provided below in the input field.

#@title **Replacing your Google Drive Path**

API_Path = "ADD_YOUR_API_PATH" #@param {type:"string"}

 

from oauth2client.service_account import ServiceAccountCredentials

import httplib2

 

SCOPES = ["https://www.googleapis.com/auth/indexing"]

ENDPOINT = "https://indexing.googleapis.com/v3/urlNotifications:publish"

print('*'*50);print("Scopes & Endpoint Configured...");print('*'*50);print("Adding Key...");print('*'*50);

# service_account_file.json is the private key that you created for your service account.

JSON_KEY_FILE = API_Path

print("Key Added Successfully!");print('*'*50);

credentials = ServiceAccountCredentials.from_json_keyfile_name(JSON_KEY_FILE, scopes=SCOPES)

http = credentials.authorize(httplib2.Http())

print("Credentials Successfully Authorized!");print('*'*50);

            Click on the "Files" icon located on the left side, then select "MyDrive".

            Next, click on the three-dot menu and upload the JSON file - the one you downloaded when creating the API from Cloud Console.

Replacing your Google Drive path 1

            After the upload is complete, click on the three-dot menu again and then select "Copy path".

Replacing your Google Drive path 2

            Paste the JSON API file address, which you just copied, and click "Run cell".

            You will then receive a success message.

Replacing your Google Drive path 3


Step 8: Replacing your Blogger URL and run the code

            Click on "+Code". Paste the code provided below in the input field.

#@title **Replacing Your Blogger URL and Run the Code**

#@markdown Site URL will the exact URL you want to update or delete from the Google Search Index. **Also, please make a note that you have to provide URL only for the ownership verfied website. For any other URLs, it will not work.**

siteURL = "REPLACE_YOUR_URL" #@param {type:"string"}

requestType = "URL_UPDATED" #@param ["URL_UPDATED", "URL_DELETED"]

content = str({'url':siteURL,'type':requestType})

print("RESULT:");print('*'*50);print("URL and Update Request Type Configured!");print('*'*50);

 

response, content = http.request(ENDPOINT, method="POST", body=content)

output = response['status']

 

if output == '200':

  print("Successfully Done!");print('*'*50);

 

else:

  print("Error Code: {}".format(output));print('*'*50);

  print("Visit Here For More: https://developers.google.com/search/apis/indexing-api/v3/core-errors#api-errors");

  print('*'*50);

            Click on the input field, paste your Blogger post link, and click "Run cell". A success message will be displayed confirming the operation.

Replacing your Blogger URL and run the code

        Note: Remember to bookmark this link. If you need to submit a new Blogger post URL in the future, return to this link and repeat all steps from Step 6.

        By following these steps, you've successfully set up the Google Indexing API for your Blogger website. Your website will now be efficiently indexed by Google, contributing to better search engine visibility.

        Note: This API is used to attract bots & crawlers to our website. These entities will assess whether your website is ready to be indexed. If the site is crawled successfully, your article will likely be indexed within a day or two.





Post a Comment

0 Comments